import {request} from './request';

export const fetchDevices = () => {
    return request({
        url: '/api/token/sc-device/',
        method: 'get',
    });
};

export const fetchDevice = id => {
    return request({
        url: `/api/token/sc-device/${id}`,
        method: 'get',
    });
};

export const updateDevice = device => {
    return request({
        url: `/api/token/sc-device/${device.id}`,
        method: 'post',
        data: device
    });
};

export const saveDevice = device => {
    return request({
        url: `/api/token/sc-device/`,
        method: 'put',
        data: device
    });
};


export const CTL_WS_URL = `ws://superctl.levent8421.com/api/ws/device-ctl`;